package com.bocai.dahuatech.ui.adapter;

import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;

import java.util.List;

public class GuideVpAdapter extends PagerAdapter {
    private List<View> mViewContainer;

    public GuideVpAdapter(List<View> mViewContainer) {
        this.mViewContainer = mViewContainer;
    }

    @Override
    public int getCount() {
        return mViewContainer.size();
    }

    @Override
    public boolean isViewFromObject(View arg0, Object arg1) {
        return arg0 == arg1;
    }

    @Override
    public Object instantiateItem(View container, int position) {

        ((ViewPager) container).addView(mViewContainer.get(position));

        return mViewContainer.get(position);
    }

    @Override
    public void destroyItem(View container, int position, Object object) {
        ((ViewPager) container).removeView(mViewContainer.get(position));
    }

    @Override
    public int getItemPosition(Object object) {
        return super.getItemPosition(object);
    }

}
